<?php
// $Id: util.php 181 2012-02-27 05:32:22Z tomqin@gmail.com $

defined('IN_ADMIN') or exit('Access Denied!');

class Util_Controller extends AdminController{

	function onIndex(){

	}

	function onZone(){
		$category = Base::loadModule('admin/category', true);

		$pid = intval($_GET['pid']);
		$zid = intval($_GET['zid']);

		echo $category->getZoneSelect($pid, $zid);
	}

	function onCacheZone(){
		$zone = Base::loadModule('zone', true);
		$zone->initCity();
		$zone->makeCache();

		$this->renderDialog('区域缓存更新成功');
	}

	//未标点区域
	function onNoneDelivery(){
		$data = DB::getAll('select s.res_id, s.name from
			`t_store` s left JOIN
			(SELECT res_id, count(res_id) as total  from `t_deliver` group by res_id) d
			  ON d.res_id = s.res_id
		 WHERE d.res_id IS NULL');

		echo '<h2>未标注配送区域</h2>';
		foreach($data as $row){
			echo '<br />';
			echo $row['res_id'].' - <a taget="_blank" href="/admin/index.php?c=store&a=modify&res_id='.$row['res_id'].'">'.h($row['name']).'</a>';
		}
	}
/*
	function onUpdateZone(){
		$zone = Base::loadModule('zone', true);
		$zone->initCity();

		$stmt = DB::prepare('update t_zone set ename = ?, letter = ? where city_id = ? and zone_id = ?');
		foreach($zone->getData() as $zone){
			$stmt->execute(array(
					$zone->pinyin,
					strtoupper(substr($zone->pinyin, 0, 1)),
					$this->cityid,
					$zone->zone_id)
			);
			print_r($zone);
		}
	}
*/
}
?>